#ifndef _MY_WIFI_H
#define _MY_WIFI_H

#include <WString.h>

#define WIFI_CYCLE 500
#define WIFI_TIME_OUT 20000 /*20s超时*/

enum class WIFI_STATUS : char
{
    /*STATUS*/
    AP_CONFIG = 0,
    AP_RUNNING,
    STA_CONFIG,
    STA_RUNNING,
    STA_RECONNECT,
    STA_CONNECTING    
};

enum class WIFI_CMD : char
{
    /*COMMAND*/
    NOP,
    STA_CONFIG,
    STA_DISCONNECT
};


class MyWiFi
{
private:
    String      _ssid;
    String      _pwd;
    int         _timeCout;
    WIFI_STATUS _wifiStatus;
    WIFI_CMD    _cmd;

private:
    void initAP(void);
    void initSTA(void);

public:
    MyWiFi(void);
    ~MyWiFi(void);

public:
    void stateMachine(void);
    void sendCmd(WIFI_CMD cmd);
    void configArg(String ssid, String pwd);
};

#endif //_MY_WIFI_H